from selenium.webdriver.common.by import By


class LoginPage:
    def __init__(self, driver):
        self.driver = driver

    def find_username(self):
        xpath = '/html/body/form/div/div/div/div[2]/div[3]/input'
        elem = self.driver.find_element(By.XPATH, xpath)
        return elem

    def find_password(self):
        xpath = '/html/body/form/div/div/div/div[2]/div[4]/input'
        elem = self.driver.find_element(By.XPATH, xpath)
        return elem

    def find_verifycode_img(self):
        xpath = '//*[@id="zymImg"]'
        elem = self.driver.find_element(By.XPATH, xpath)
        # src = elem.get_property('src')
        # onclick="changeImg(this)"
        return elem

    def find_verifycode(self):
        xpath = '/html/body/form/div/div/div/div[2]/div[5]/input'
        elem = self.driver.find_element(By.XPATH, xpath)
        return elem

    def find_login_btn(self):
        xpath = '//*[@id="login"]'
        elem = self.driver.find_element(By.XPATH, xpath)
        return elem
